package chapter3.No3_1_等待和通知机制.c等待通知机制的实现.demo3;

/**
 * 1. wait()和notify()必须在同步方法或者同步块中执行
 * 2. wait()方法在执行的时候立刻释放掉锁，并且进入“预执行队列中”
 *    notify()方法在执行的时候不会立刻释放掉锁，而是把同步的代码执行完成以后，再释放锁
 * Created by Administrator on 2016/11/16.
 */
public class Main {
    public static void main(String[] args) throws InterruptedException {
        Object lock = new Object();
        ThreadA a = new ThreadA(lock);
        ThreadB b = new ThreadB(lock);
        a.start();

        Thread.sleep(2000);
        b.start();
    }
}
